home *** CD-ROM | disk | FTP | other *** search
/ Best of www.BestZips.com (Collector's Edition) / Best of WWW.BESTZIPS.COM Collector's Edition (JCSM Shareware) (JCS Marketing).ISO / tutorial / adatu311.zip / VANILLA.ADA < prev    next >
Text File  |  1996-01-10  |  3KB  |  55 lines

  1. -- VANILLA.ADA   Ver. 3.11   10-JAN-1996   Copyright 1988-1996 John J. Herro
  2. --
  3. -- SOFTWARE INNOVATIONS TECHNOLOGY          http://members.aol.com/AdaTutor
  4. -- 1083 MANDARIN DR NE                      ftp://members.aol.com/AdaTutor
  5. -- PALM BAY FL 32905-4706
  6. --                                          johnherro@aol.com
  7. -- (407) 951-0233                           john.herro%374-38-2@satlink.oau.org
  8. --
  9. -- "Plain vanilla" version of CUSTOM_IO which should work with ANY standard Ada
  10. -- 83 or Ada 95 compiler.  Compile this before compiling ADA_TUTR.ADA.
  11. --
  12. with Text_IO;
  13. package Custom_IO is
  14.    type Color is (Black, Red, Green, Yellow, Blue, Magenta, Cyan, White);
  15.    Foregrnd_Color   : Color := White;                 -- Default values in case
  16.    Backgrnd_Color   : Color := Black;                 -- ADA-TUTR finds no User
  17.    Border_Color     : Color := Black;                 -- File.
  18.    Fore_Color_Digit : Character := Character'Val(Color'Pos(Foregrnd_Color)+48);
  19.    Back_Color_Digit : Character := Character'Val(Color'Pos(Backgrnd_Color)+48);
  20.    Normal_Colors    : String(1 .. 10) := ASCII.ESC & "[0;3" &
  21.                               Fore_Color_Digit & ";4" & Back_Color_Digit & "m";
  22.    Clear_Scrn       : constant String := ASCII.ESC & "[H" & ASCII.ESC & "[2J";
  23.  
  24.    procedure Set_Border_Color (To   : in  Color);
  25.    procedure Get              (Char : out Character) renames Text_IO.Get;
  26.    procedure Put              (Char : in  Character) renames Text_IO.Put;
  27.    procedure Put              (Str  : in  String)    renames Text_IO.Put;
  28.    procedure Put_Line         (Str  : in  String)    renames Text_IO.Put_Line;
  29.    procedure Get_Line         (Str  : out String;
  30.                                Last : out Natural)   renames Text_IO.Get_Line;
  31.    procedure New_Line      (Spacing : in  Text_IO.Count := 1)
  32.                                                      renames Text_IO.New_Line;
  33. end Custom_IO;
  34.  
  35. package body Custom_IO is
  36.    procedure Set_Border_Color(To : in Color) is
  37.       --
  38.       -- This is a dummy procedure.  If your PC Ada compiler allows interrupt
  39.       -- calls or assembly language, you may want to write code to call
  40.       -- interrupt 10 hex.  (See JANUS16.PKG, JANUS32.PKG, and OPEN.ADA for
  41.       -- examples.)  Before the call, set register AH to service number 0B hex,
  42.       -- set BH to zero, and set BL to Color_Number(To), where Color_Number is
  43.       -- declared below.  Note that the integers in Color_Number are bit
  44.       -- reversed from the integers defining foreground and background colors
  45.       -- in ANSI escape sequences.  Note also that some color PCs don't have
  46.       -- separate border colors.
  47.       --
  48.       Color_Number : constant array(Color) of Integer :=
  49.           (Black   => 0,   Red     => 4,   Green   => 2,   Yellow  => 6,
  50.            Blue    => 1,   Magenta => 5,   Cyan    => 3,   White   => 7);
  51.    begin
  52.       null;
  53.    end Set_Border_Color;
  54. end Custom_IO;
  55.